package com.oa.service.impl;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;

import com.oa.dao.DeptDao;
import com.oa.entity.Dept;
import com.oa.service.DeptService;

//该Bean工作在业务层
@Service
@Transactional
public class DeptServiceImpl implements DeptService {
	//调用dao层的代码
	@Resource
	private DeptDao deptDao;
	@Override
	public int saveDept(Dept dept) {
		deptDao.saveDept(dept);//添加
		//测试回滚事务把注释打开
		//deptDao.deleteDept(18);//删除 更新 添加 失败
		return 0;
	}
	public DeptDao getDeptDao() {
		return deptDao;
	}
	public void setDeptDao(DeptDao deptDao) {
		this.deptDao = deptDao;
	}
	@Override
	public int deleteDept(int deptno) {
		return deptDao.deleteDept(deptno);
	}
	

}
